home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / Health Monitor 2.1 / HealthMonitor.msi / _A9A458837CEAFF9D55B2EAE342FFA8DF / _BCEA666074904C6687963E705C78BEF8 < prev    next >
Encoding:
Text File  |  2005-01-03  |  795 b   |  24 lines

  1. ' ***************************************************************
  2. ' * CheckTS_Sessions.vbs                           *        
  3. ' * By Vittorio Pavesi (www.vittorio.tk)              *
  4. ' *                                * 
  5. ' * Check number of active Terminal Server Sessions        *     
  6. ' * and return details (works only on 2003 or greater)        *
  7. ' ***************************************************************
  8.  
  9. CheckTS(2)
  10.  
  11. Sub CheckTS(MaxNSession)
  12.     Set Sess1 = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_TSAccount")
  13.     SessionN = 0
  14.     for each Session in Sess1
  15. '       WScript.Echo session.sid
  16.        SessionN =SessionN +1
  17.     Next
  18.     if SessionN <= MaxNSession then
  19.         WScript.Echo "OK" 
  20.     else
  21.         WScript.Echo "Error" 
  22.     end if
  23.     WScript.Echo SessionN & " TS sessions"
  24. End sub